using System;

namespace FakeGameEngine
{
    public static class Time
    {
        public static int FrameCount { get; private set; }
        public static float CurrentTime { get; private set; }
        public static float DeltaTime { get; private set; }

        #region GameEngine
        private static System.DateTime CurrentDateTime;
        private static System.DateTime StartDateTime;

        // called when game start running
        public static void Reset()
        {
            FrameCount = 0;
            CurrentTime = 0;
            DeltaTime = 0;
            CurrentDateTime = StartDateTime = DateTime.Now;
        }

        // can only be called when frame start
        public static void Update()
        {
            FrameCount++;
            var timeSpan = DateTime.Now - Time.CurrentDateTime;
            DeltaTime = (float)timeSpan.TotalSeconds;
            CurrentTime = (float)(DateTime.Now - StartDateTime).TotalSeconds;
        }
        #endregion
    }
}